package org.nerve.webmagic.downloader;

import org.nerve.webmagic.DriverBuilder;
import org.nerve.webmagic.PhantomjsDriverBuilder;
import org.nerve.webmagic.bean.SpiderConfig;
import org.openqa.selenium.phantomjs.PhantomJSDriver;

/**
 * 使用ThreadLocal来储存WebDriver
 * org.nerve.webmagic.spider
 * Created by zengxm on 2016/4/20 0020.
 */
public class PhantomJSDownloader extends AbstractRemoteDriverDownloader<PhantomJSDriver> {

	public PhantomJSDownloader(final SpiderConfig config) {
		super(config);
	}
//
//	@Override
//	protected PhantomJSDriver getDriver(Site site) throws IOException {
//		PhantomJSDriver driver=driverThreadLocal.get();
//		if(driver==null && site!=null){
//			driver=new PhantomjsDriverBuilder().build(config);
//			driverThreadLocal.set(driver);
//		}
//
//		return driver;
//	}


	@Override
	protected DriverBuilder<PhantomJSDriver> getDriverBuilder() {
		return new PhantomjsDriverBuilder();
	}
}
